package main

import (
	"flag"
	"path/filepath"
	"yunfei/lib/config"
	"yunfei/lib/loglib"
)

var fullconfig config.FullConfig

func init() {
	s := flag.String("f", "", "usage: COMMAND -f ./config.ini")
	flag.Parse()

	if *s == "" {
		flag.Usage()
		panic("please specifies the config file")
	}
	configFileDir, _ := filepath.Abs(*s)

	//初始化loglib
	loglib.Loginit()
	//调用loglib 写日志到文件
	loglib.Mylog.Println("程序开始运行")
	//获取配置文件
	fullconfig = config.Configinit(configFileDir)
	loglib.Mylog.Println("配置文件解析")
}

func main() {
	loglib.Mylog.Println(fullconfig)
}
